import router from './router'
import NProgress from "@/utils/nprogress";


const getTitle = (title) => {
  return title ? `${title}-${import.meta.env.VITE_VUE_BASE_TITLE}` : import.meta.env.VITE_VUE_BASE_TITLE
}

router.beforeEach(async (to, from, next) => {
  NProgress.start()
  document.title = getTitle(to.meta.title)
  next()
  NProgress.done()
})

router.afterEach(() => {
  NProgress.done()
})

